<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<title>企业查询结果</title>
	<link rel="stylesheet" href="/css/style.css">
	<link rel="stylesheet" type="text/css" href="/css/jquery.my-modal.1.1.winStyle.css" />
	<script src="/js/jquery.min.js"></script>
	<script type="text/javascript" src="/js/jquery.my-modal.1.1.js"></script>
</head>
<body style="background: #F2F2F2;">
<form class="serach" action="" method="post">
	{{ csrf_field() }}
	<input type="hidden" name="categoryId" value="">
	<input class="text" type="text" name="keywords" value="" placeholder="请输入关键字进行搜索" />
	<input class="sub" type="submit" value="搜  索" name="" />
	<input class="sub" style="background: #FF9800" type="button" value="新增" name="" onclick="add();" />
	<div style="clear: both;"></div>
</form>

<div class="lists lists-s">
	@foreach($data as $v)
		<dl>
			<dt>{{$v->project_name}}</dt>
			<dd>
				<a href="javascript:;" data-id="{{$v->id}}" data-name="{{$v->project_name}}" onclick='update(this);'>编辑</a>
				<a style="background: #05D380" href="{{route('project_company', array('projectId'=>$v->id))}}">公司</a>
				<a style="background: #9E9E9E" href="/ninesmall/project_statistics?project={{$v->id}}">统计</a>
				<a style="background: #F44336" href="javascript:;"  data-id="{{$v->id}}" onclick='shanchu(this)'>删  除</a>
			</dd>
		</dl>
	@endforeach
</div>
<div class="m-modal-update" style="display: none">
	<div class="m-modal-dialog-update">
		<div class="m-top">
			<h4 class="m-modal-title">
				编辑
			</h4>
			<span class="m-modal-close-update">&times;</span>
		</div>
		<form action="/project/update" method="post">
			{{ csrf_field() }}
			<div class="m-middle">
				<input type="hidden" id="project_id" name="project_id" value="">
				<p>项目名称</p>
				<input class="chryec" type="text" id="update_name" name="name" placeholder="请输入项目名称">
			</div>
			<div class="m-bottom">
				<button type="submit" class="m-btn-sure-update" style="background-color: #337ab7;border-color: #337ab7;color: #fff">确定</button>
				<button class="m-btn-cancel-update">取消</button>
			</div>
		</form>
	</div>
</div>
<div class="m-modal">
	<div class="m-modal-dialog">
		<div class="m-top">
			<h4 class="m-modal-title">
				新增
			</h4>
			<span class="m-modal-close">&times;</span>
		</div>
		<form action="/one" method="post">
			{{ csrf_field() }}
			<div class="m-middle">
				<p>项目名称</p>
				<input class="chryec" type="text" name="name" placeholder="请输入项目名称">
			</div>
			<div class="m-bottom">
				<button type="submit" class="m-btn-sure">确定</button>
				<button class="m-btn-cancel">取消</button>
			</div>
		</form>
	</div>
</div>

<script>
	function add() {
		var m1 = new MyModal.modal(function() {
		});
		m1.show();
	}
	function update(_this) {
		var id = ($(_this).attr('data-id'));
		var name = ($(_this).attr('data-name'));
		$('#update_name').val(name);
		$('#project_id').val(id);
		var m2 = new updateModal.modal(function() {
		});
		m2.show();
	}

	function shanchu(_this) {
		if(confirm("确定要删除吗？"))
		{var id = (($(_this).attr('data-id')));
			$.post("project/delete",{id:id},function(result){
				if (result) location.reload();
			});}else
		{return false;}
	}
</script>
</body>
</html>